home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import re
- import os.path as os
- import logging
- import subprocess
- from glob import glob
- from jockey.oslib import OSLib
- from jockey.handlers import KernelModuleHandler
-
- def _(x):
- return x
-
-
- class BroadcomWLHandler(KernelModuleHandler):
- '''Handler for Broadcom Wifi chipsets which use the wl module.'''
-
- def __init__(self, ui):
- self.bl_file = os.path.join(os.path.dirname(OSLib.inst.module_blacklist_file), 'blacklist-bcm43.conf')
- self._free = False
- KernelModuleHandler.__init__(self, ui, 'wl', name = _('Broadcom STA wireless driver'))
-
-
- def enabled(self):
- km = KernelModuleHandler.enabled(self)
- bcm = OSLib.inst.module_blacklisted('bcm43xx')
- b43 = OSLib.inst.module_blacklisted('b43')
- b43_legacy = OSLib.inst.module_blacklisted('b43legacy')
- if not KernelModuleHandler.module_loaded('b43xx') and KernelModuleHandler.module_loaded('b43'):
- pass
- b43_loaded = KernelModuleHandler.module_loaded('b43legacy')
- if not km or 'enabled':
- pass
- if not bcm or 'blacklisted':
- pass
- if not b43 or 'blacklisted':
- pass
- if not b43_legacy or 'blacklisted':
- pass
- logging.debug('BroadcomWLHandler enabled(): kmod %s, bcm43xx: %s, b43: %s, b43legacy: %s' % ('disabled', 'enabled', 'enabled', 'enabled'))
- if (km or not b43_loaded) and km and bcm and b43:
- pass
- return b43_legacy
-
-
- def used(self):
- '''Return if the handler is currently in use.'''
- if KernelModuleHandler.used(self) and self.enabled():
- if not KernelModuleHandler.module_loaded('b43') and KernelModuleHandler.module_loaded('b43legacy'):
- pass
- return not KernelModuleHandler.module_loaded('bcm43xx')
-
-
- def enable(self):
- '''Disable b43 drivers, so that wl can become active.
-
- This also adds a workaround for loading wl first if b44 is used.
- '''
- if not os.path.exists(self.bl_file):
- f = open(self.bl_file, 'w')
- f.write('blacklist bcm43xx\nblacklist b43\nblacklist b43legacy\nblacklist ssb\n')
- if KernelModuleHandler.module_loaded('b44'):
- f.write('# load wl before b44 so that both work\nblacklist b44\ninstall wl modprobe -r b43 b44 b43legacy ssb; modprobe --ignore-install wl $CMDLINE_OPTS; modprobe --ignore-install b44\n')
-
- f.close()
- OSLib.inst._load_module_blacklist()
- subprocess.call([
- '/usr/sbin/update-initramfs',
- '-u'])
-
- KernelModuleHandler.enable(self)
-
-
- def disable(self):
- '''Unblacklist b43 drivers again, so that they trump wl.'''
- if os.path.exists(self.bl_file):
- os.unlink(self.bl_file)
- OSLib.inst._load_module_blacklist()
- subprocess.call([
- '/usr/sbin/update-initramfs',
- '-u'])
-
- KernelModuleHandler.disable(self)
-
-
-